/*
 * @Author: Troubadour 2276791354@qq.com
 * @Date: 2024-03-22 09:34:34
 * @LastEditors: Troubadour 2276791354@qq.com
 * @LastEditTime: 2024-03-22 16:29:36
 * @FilePath: \ANR_RS01\anr_rs01.h
 * @Description:
 */


#ifndef __ANR_RS01_H__
#define __ANR_RS01_H__

#include <stdint.h>


#define RS01_QUANTITY (2)


/* RS01 type. */
typedef struct
{
    uint32_t id;    /* Sensor ID. */
    uint8_t BettryLevel;  /* battery level. */
    float BettryVol;  /* battery voltage. */
    uint16_t TirePressure;      /* Tire pressure. Unit: Kpa. */
    char Temp;     /* Sensor temperature. Unit: C. */
    uint8_t Number; /* Sensor tire number. */
    uint8_t CheckSum; /* Checksum. Calculation method: 0XFF-SUM(byte2~byte9) */
    uint8_t UpdataFlag; /* Check for new data. If there is new data for 1, then there is no data for 0. */
}RS01_TypeDef;


uint8_t RS01_UnpackBuffer(uint8_t *DataBuff, uint16_t DataLen);
uint8_t RS01_SetBindingID(uint8_t num, uint32_t id);
uint32_t RS01_GetId(uint8_t num);
uint8_t RS01_GetBettryLevel(uint8_t num);
float RS01_GetBettryVoltage(uint8_t num);
uint16_t RS01_GetTirePressure(uint8_t num);
char RS01_GetTemperature(uint8_t num);
uint8_t RS01_GetChecksum(uint8_t num);
uint8_t RS01_GetUpdataState(uint8_t num);
void RS01_Init(void);





#endif  /* __ANR_RS01_H__ */